#	Copyright (C) 2011 Salil Bhagurkar
#
#	This file is part of illusion
#
#	illusion is free software: you can redistribute it and/or modify
#	it under the terms of the GNU Lesser General Public License as
#	published by the Free Software Foundation, either version 3 of
#	the License, or (at your option) any later version.
#
#	illusion is distributed in the hope that it will be useful,
#	but WITHOUT ANY WARRANTY; without even the implied warranty of
#	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#	GNU Lesser General Public License for more details.
#
#	You should have received a copy of the GNU Lesser General Public
#	License along with illusion.
#	If not, see <http://www.gnu.org/licenses/>.

OBJECTS := amload.o apimod.o lib.o snprintf.o ini.o args.o malloc.o string.o
OUTPUT := apimod.exe

CC := i686-elf-gcc
CFLAGS := -O0 -I.. -c -m32 -ffreestanding -nostdinc -Wall -g -std=c99 -fleading-underscore -Werror -Wno-unused
LD := i686-elf-ld
LDFLAGS := -Tlink.ld -nostdlib -nodefaultlibs

AS := nasm
ASFLAGS := -felf32

all: apimod

apimod: $(OBJECTS)
	$(LD) $(LDFLAGS) -o $(OUTPUT) $(OBJECTS)

clean:
	rm -f $(OBJECTS) $(OUTPUT)

%.o: %.c kernel/config.h Makefile
	$(CC) $(CFLAGS) $< -o $@

%.o: %.s kernel/config.h Makefile
	$(AS) $(ASFLAGS) $< -o $@
